org.eclipse.vtp.desktop.projects.core
Class ColumnType

java.lang.Object
  extended by org.eclipse.vtp.desktop.projects.core.ColumnType

public class ColumnType
extends java.lang.Object

This class encapsulates the possible data types assigned to database table columns. Only the standard SQL-92 types are supported.

Version:
2.0
Author:
Trip Gilman

Field Summary
static ColumnType BIGDECIMAL
          Definition of a typical 8 byte BIGDECIMAL column.
static ColumnType BIGNUMBER
          Definition of a typical 8 byte BIGNUMBER column.
static ColumnType BOOLEAN
          Definition of a typical BOOLEAN column.
static ColumnType DATETIME
          Definition of a typical DATETIME column.
static ColumnType DECIMAL
          Definition of a typical 4 byte DECIMAL column.
static ColumnType NUMBER
          Definition of a typical 4 byte NUMBER column.
static ColumnType TEXT
          Definition of a typical TEXT column.
static ColumnType VARCHAR
          Definition of a typical VARCHAR column with 45 characters.
 
Constructor Summary
protected ColumnType(java.lang.String typeName, int length)
          Creates a new ColumnType with the given type name and data storage length.
 
Method Summary
 boolean canAutoIncrement()
          Determines if the data type of the column can also be configured to auto increment.
static ColumnType custom(java.lang.String typeName, int length, boolean nullable, boolean autoIncrement)
          Constructs a new ColumnType from the given type name, data length, nullable flag, and auto increment flag.
 int getLength()
           
 java.lang.String getTypeName()
           
 boolean isAutoIncrement()
           
 boolean isNullable()
          Determines if the column can accept or contain NULL values.
static ColumnType load(org.w3c.dom.Element element)
          Constructs a new ColumnType from the information stored in the given XML DOM sturcture.
 void write(org.w3c.dom.Element parent)
          Generates the XML DOM elements and attributes required to save the information for this column type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VARCHAR

public static final ColumnType VARCHAR
Definition of a typical VARCHAR column with 45 characters.


NUMBER

public static final ColumnType NUMBER
Definition of a typical 4 byte NUMBER column.


BIGNUMBER

public static final ColumnType BIGNUMBER
Definition of a typical 8 byte BIGNUMBER column.


DECIMAL

public static final ColumnType DECIMAL
Definition of a typical 4 byte DECIMAL column.


BIGDECIMAL

public static final ColumnType BIGDECIMAL
Definition of a typical 8 byte BIGDECIMAL column.


BOOLEAN

public static final ColumnType BOOLEAN
Definition of a typical BOOLEAN column.


DATETIME

public static final ColumnType DATETIME
Definition of a typical DATETIME column.


TEXT

public static final ColumnType TEXT
Definition of a typical TEXT column.

Constructor Detail

ColumnType

protected ColumnType(java.lang.String typeName,
                     int length)
Creates a new ColumnType with the given type name and data storage length.

Parameters:
typeName - The name of the column data type
length - The number of bytes used to store the column values
Method Detail

canAutoIncrement

public boolean canAutoIncrement()
Determines if the data type of the column can also be configured to auto increment.

Returns:
true if the column is a NUMBER | BIGNUMBER, false otherwise.

getLength

public int getLength()
Returns:
The number of bytes used to store the column data type values

isNullable

public boolean isNullable()
Determines if the column can accept or contain NULL values.

Returns:
true if the column will accept or contain NULL values, false otherwise.

isAutoIncrement

public boolean isAutoIncrement()
Returns:
true if the column is configured to auto increment, false otherwise.

getTypeName

public java.lang.String getTypeName()
Returns:
The data type name of this column type

write

public void write(org.w3c.dom.Element parent)
Generates the XML DOM elements and attributes required to save the information for this column type.

Parameters:
parent - The parent XML DOM element that will contain the column type information

custom

public static ColumnType custom(java.lang.String typeName,
                                int length,
                                boolean nullable,
                                boolean autoIncrement)
Constructs a new ColumnType from the given type name, data length, nullable flag, and auto increment flag. This is the primary method of instanciating this class.

Parameters:
typeName - The data type name for the column type
length - The number of bytes used to store this column types values
nullable - A flag indicating whether this column type will accept or contain NULL values
autoIncrement - A flag indicating whether this column type will automatically increment when new records are added to its database table
Returns:
A ColumnType instance representing the given column type information

load

public static ColumnType load(org.w3c.dom.Element element)
Constructs a new ColumnType from the information stored in the given XML DOM sturcture. The information must be stored the same format produced by the write() function of this class.

Parameters:
element - The element that contains the formated data
Returns:
The new ColumnType instance represented by the given column type information